package com.project.mapper;

import com.project.pojo.Teacher;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface TeacherMapper {
    /**
     * 增加教师用户
     */
    @Insert("insert into tb_teacher (id, teacherId, password, tName, buildId, tnumber) " +
            "values (null,#{teacherId},#{password},#{tName},#{buildId},#{tnumber});")
    void addTeacher(Teacher teacher);

    /**
     * 根据id删除教师用户
     */
    @Delete("delete from tb_teacher where id = #{id};")
    void deleteTeacher(long id);

    /**
     * 修改教师用户
     */
    @Update("update tb_teacher " +
            "set teacherId = #{teacherId},password = #{password}," +
            "tName = #{tName},buildId=#{buildId},tnumber =#{tnumber} where id=#{id}")
    void updateTeacher(Teacher teacher);

    /**
     * 根据信息查询教师用户
     */
    List<Teacher> selectTeacher(Teacher teacher);

    /**
     * 查询所有教职工
     * @return
     */
    List<Teacher> selectAllTeacher();

    /**
     * 登陆精准验证
     */
    @Select("select * from tb_teacher where teacherId = #{teacherId} and password =#{password};")
    Teacher login(@Param("teacherId") String teacherId, @Param("password") String password);
}
